﻿<%@ Page Language="C#"  MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"  CodeFile="ShelfEdit.aspx.cs" Inherits="ShelfEdit" Title="Shelf Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">Shelf - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
		<data:MultiFormView ID="FormView1" DataKeyNames="Shelf" runat="server" DataSourceID="ShelfDataSource">
		
			<EditItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/ShelfFields.ascx" />
			</EditItemTemplatePaths>
		
			<InsertItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/ShelfFields.ascx" />
			</InsertItemTemplatePaths>
		
			<EmptyDataTemplate>
				<b>Shelf not found!</b>
			</EmptyDataTemplate>
			
			<FooterTemplate>
				<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
				<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
				<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
			</FooterTemplate>

		</data:MultiFormView>
		
		<data:ShelfDataSource ID="ShelfDataSource" runat="server"
			SelectMethod="GetByShelf"
		>
			<Parameters>
				<asp:QueryStringParameter Name="Shelf" QueryStringField="Shelf" Type="String" />

			</Parameters>
		</data:ShelfDataSource>
		
		<br />

		<data:EntityGridView ID="GridViewDrugDispo1" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewDrugDispo1_SelectedIndexChanged"			 			 
			DataSourceID="DrugDispoDataSource1"
			DataKeyNames="DrugId"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_DrugDispo.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<asp:BoundField DataField="DrugName" HeaderText="Drug Name" SortExpression="[DrugName]" />				
				<asp:BoundField DataField="GenericName" HeaderText="Generic Name" SortExpression="[GenericName]" />				
				<asp:BoundField DataField="Specification" HeaderText="Specification" SortExpression="[Specification]" />				
				<data:HyperLinkField HeaderText="Unit" DataNavigateUrlFormatString="UnitTableEdit.aspx?Unit={0}" DataNavigateUrlFields="Unit" DataContainer="UnitSource" DataTextField="Unit" />
				<asp:BoundField DataField="CostPrice" HeaderText="Cost Price" SortExpression="[CostPrice]" />				
				<asp:BoundField DataField="SellPrice" HeaderText="Sell Price" SortExpression="[SellPrice]" />				
				<asp:BoundField DataField="ValidPeriod" HeaderText="Valid Period" SortExpression="[ValidPeriod]" />				
				<asp:BoundField DataField="MinStock" HeaderText="Min Stock" SortExpression="[MinStock]" />				
				<asp:BoundField DataField="MaxStock" HeaderText="Max Stock" SortExpression="[MaxStock]" />				
				<data:HyperLinkField HeaderText="Shelf" DataNavigateUrlFormatString="ShelfEdit.aspx?Shelf={0}" DataNavigateUrlFields="Shelf" DataContainer="ShelfSource" DataTextField="Remark" />
				<asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />				
			</Columns>
			<EmptyDataTemplate>
				<b>No Drug Dispo Found! </b>
				<asp:HyperLink runat="server" ID="hypDrugDispo" NavigateUrl="~/admin/DrugDispoEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:DrugDispoDataSource ID="DrugDispoDataSource1" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:DrugDispoProperty Name="Shelf"/> 
					<data:DrugDispoProperty Name="UnitTable"/> 
					<%--<data:DrugDispoProperty Name="GrnDetailsCollection" />--%>
					<%--<data:DrugDispoProperty Name="StockCollection" />--%>
					<%--<data:DrugDispoProperty Name="DrugDiscountCollection" />--%>
					<%--<data:DrugDispoProperty Name="PrescriptionDetailCollection" />--%>
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:DrugDispoFilter  Column="Shelf" QueryStringField="Shelf" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:DrugDispoDataSource>		
		
		<br />
		

</asp:Content>

